package com.study.demo_spring_security.service;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;

/**
 * @ClassName: MethodService
 * @Description:
 * @author: WS
 * @date 2020/12/28
 * @Version: 1.0
 **/
@Service
public class MethodService {
    @PreAuthorize("hasRole('user')")
    public String user(){
        return "hello user";
    }
    @Secured("ROLE_admin")
    public String admin(){
        return "hello admin";
    }
    @PreAuthorize("hasAnyRole('user','admin')")
    public String hello(){
        return "hello hello";
    }
}
